<script type="text/ng-template" id="movieSearchTemplate.html">
	<a>
		<span ng-bind-html="match.model.title | highlight:query:'highlightBold'"></span>
		({{ match.model.year}})
	</a>
</script>

<div class="text-center">
	{{ 'WATCHER.SEARCH_BY_IMDB' | translate}}: <a href="http://anonym.to/?http://www.imdb.com/" target="_blank">www.imdb.com</a>
	<input type="text" class="form-control" ng-model="vm.asyncSelected" uib-typeahead="movie.title for movie in vm.getMovieData($viewValue)" typeahead-on-select="vm.onSelected($item)" typeahead-template-url="movieSearchTemplate.html" style="width: 300px; margin: auto;" />
</div>

<h2 translate="WATCHER.WATCHING_MOVIES"></h2>

<loading-indicator hide="vm.watching"></loading-indicator>

<div class="col-md-10 col-centered" ng-show="vm.watching">
	<table class="table table-striped table-hover table-nowrap table-text-center">
		<tr class="colhead">
			<th class="text-left" translate="WATCHER.NAME"></th>
			<th style="width: 350px;" translate="WATCHER.FORMAT"></th>
			<th style="width: 120px;" translate="WATCHER.REQUIRE_SUB"></th>
			<th style="width: 100px;" translate="WATCHER.STOP"></th>
		</tr>
		<tr ng-repeat="w in vm.watching | filter: {typ : 0}">
			<td class="text-left">
				<a target="_blank" href="http://anonym.to/?http://www.imdb.com/title/{{ w.imdbid }}/" ng-mouseenter="showPoster = true" ng-mouseleave="showPoster = false">{{ w.title }}</a> ({{ w.year }})
				<div class="hoverPoster" ng-show="showPoster && w.imdbid2" style="background-image: url('/img/imdb/{{ ::w.imdbid2 }}.jpg');"></div>
			</td>
			<td>
				<button class="btn btn-default btn-xs" ng-model="w.formats.hd720" uib-btn-checkbox ng-change="vm.updateWatch(w)">720p</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.hd1080" uib-btn-checkbox ng-change="vm.updateWatch(w)">1080p</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.dvdrpal" uib-btn-checkbox ng-change="vm.updateWatch(w)">DVDR PAL</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.dvdrcustom" uib-btn-checkbox ng-change="vm.updateWatch(w)">DVDR CUSTOM</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.bluray" uib-btn-checkbox ng-change="vm.updateWatch(w)">BLURAY</button>
			</td>
			<td>
				<button class="btn btn-default btn-xs" ng-model="w.swesub" uib-btn-checkbox ng-change="vm.updateWatch(w)" translate="WATCHER.REQUIRE_SUB"></button>
			</td>
			<td>
				<button class="btn btn-default btn-xs" ng-click="vm.deleteWatch(w)"><i class="fa fa-trash-o"></i></button>
			</td>
		</tr>
	</table>
</div>

<h2 translate="WATCHER.WATCHING_TV"></h2>

<loading-indicator hide="vm.watching"></loading-indicator>

<div class="col-md-10 col-centered" ng-show="vm.watching">
	<table class="table table-striped table-hover table-nowrap table-text-center">
		<tr class="colhead">
			<th class="text-left" translate="WATCHER.NAME"></th>
			<th style="width: 350px;" translate="WATCHER.FORMAT"></th>
			<th style="width: 120px;" translate="WATCHER.REQUIRE_SUB"></th>
			<th style="width: 100px;" translate="WATCHER.STOP"></th>
		</tr>
		<tr ng-repeat="w in vm.watching | filter: {typ : 1}">
			<td class="text-left">
				<a target="_blank" href="http://www.imdb.com/title/{{ w.imdbid }}/" ng-mouseenter="showPoster = true" ng-mouseleave="showPoster = false">{{ w.title }}</a> ({{ w.year }})
				<div class="hoverPoster" ng-show="showPoster && w.imdbid2" style="background-image: url('/img/imdb/{{ ::w.imdbid2 }}.jpg');"></div>
			</td>
			<td>
				<button class="btn btn-default btn-xs" ng-model="w.formats.hd720" uib-btn-checkbox ng-change="vm.updateWatch(w)">720p</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.hd1080" uib-btn-checkbox ng-change="vm.updateWatch(w)">1080p</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.dvdrpal" uib-btn-checkbox ng-change="vm.updateWatch(w)">DVDR TV</button>
				<button class="btn btn-default btn-xs" ng-model="w.formats.dvdrcustom" uib-btn-checkbox ng-change="vm.updateWatch(w)">DVDR CUSTOM</button>
			</td>
			<td>
				<button class="btn btn-default btn-xs" ng-model="w.swesub" uib-btn-checkbox ng-change="vm.updateWatch(w)" translate="WATCHER.REQUIRE_SUB"></button>
			</td>
			<td><button class="btn btn-default btn-xs" ng-click="vm.deleteWatch(w)"><i class="fa fa-trash-o"></i></button></td>
		</tr>
	</table>
</div>
